package com.car.serve.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.car.serve.entity.ServeProjectModifyLog;
import com.car.serve.form.ServeProjectModifyLogForm;
import com.car.serve.mapper.ServeProjectModifyLogMapper;
import com.car.serve.service.ServeProjectModifyLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 董旭
 * @since 2024-08-28
 */
@Service
public class ServeProjectModifyLogServiceImpl extends ServiceImpl<ServeProjectModifyLogMapper, ServeProjectModifyLog> implements ServeProjectModifyLogService {

    @Resource
    private ServeProjectModifyLogMapper serveProjectModifyLogMapper;
    @Override
    public Page<ServeProjectModifyLog> findPageServeProjectModifyLog(ServeProjectModifyLogForm form) {
        Page<ServeProjectModifyLog> page = new Page<>(form.getPageNum() == null ? 1 : form.getPageNum(), form.getPageSize() == null ? 6 : form.getPageSize());
        QueryWrapper<ServeProjectModifyLog> wrapper = new QueryWrapper<>();
        //判断服务名是否为空
        if (ObjectUtil.isNotEmpty(form.getProjectName())) {
            wrapper.like("project_name", form.getProjectName());
        }
        Page<ServeProjectModifyLog> serveProjectModifyLogPage = serveProjectModifyLogMapper.selectPage(page, wrapper);
        return serveProjectModifyLogPage;
    }
}
